<?php
class GlobalAction extends Action{
     protected function GlobalName(){
		function menulist($id){
		    $menu = M('menu');
		    if ($menu->where("meid = '$id'")->find())
		    {
		    	return 'list';
			}
		}
     	$system = M('system');
     	$system = $system->findall();
     	$this->assign('title',$system[0]['title']);
     	$this->assign('keywords',$system[0]['keywords']);
     	$this->assign('description',$system[0]['description']);
     	$this->assign('e_title',$system[0]['e_title']);
     	$this->assign('e_keywords',$system[0]['e_keywords']);
     	$this->assign('e_description',$system[0]['e_description']);
     	$this->assign('images_savePath',$system[0]['images_savePath']);
		$this->assign('CURRENT',__CURRENT__);
		$this->assign('Html','.'.APP_PUBLIC_PATH.'/html.html');
		$this->assign('Header','.'.APP_PUBLIC_PATH.'/header.html');
		$this->assign('Left','.'.APP_PUBLIC_PATH.'/left.html');
		$this->assign('Right','.'.APP_PUBLIC_PATH.'/right.html');
		$this->assign('Footer','.'.APP_PUBLIC_PATH.'/footer.html');
		$this->assign('APP_PUBLIC_PATH','.'.APP_PUBLIC_PATH.'/');
		$menu = M('menu');
		$menu_top = $menu->where("bottom = '0'")->findall();
		$menu_bottom = $menu->where("bottom = '1'")->findall();
		$this->assign('menu_top',$menu_top);
		$this->assign('menu_bottom',$menu_bottom);
    }
	 	protected function get_alert($contents){
	    	header("Content-type: text/html; charset=utf-8"); 
	    	echo "<script type='text/javascript'>alert('$contents');</script>";
	    }
		//以下为常用JS功能PHP封装
		protected function walert($msg,$status=true){
			echo '<script type=text/javascript>top.alert("'.$msg.'");</script>';
			$status?exit:"";
		}
		protected function Reload($window="window"){//窗口刷新
			echo '<script type=text/javascript>'.$window.'.location.reload();</script>';
		}
		protected function TWinReload(){
			$this->Reload();
		}
		protected function SelfClose(){//窗口关闭
			echo '<script type=text/javascript>window.close();</script>';
		}
		protected function Go2Url($url,$window='window'){//跳转及窗口的选择
			echo '<script type=text/javascript>'.$window.'.location.href="'.$url.'"</script>';
		}
		protected function TWinBack(){//回上一页
			echo '<script type=text/javascript>top.history.go(-1);</script>';
		}
}
?>